<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>  
<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Language" content="zh-CN">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="shop">
    <meta name="author" content="letsun">
    <title>发表评价</title>
    
 <%@ include file="../init.jsp" %>
 <link rel="stylesheet" type="text/css" href="${resources}/css/deliverComment.css">
    <style>
        .page-content {
            position: relative;
        }
        #nav {
            background-color: #DE2425;
        }

        #nav .logo .fore1 {
            background: url(${resources}/images/1_1.png) center no-repeat;
            width: 320px;
            background-size: 85%;
        }
        .mask {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            z-index: 1;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            color: #FFF;
            text-align: center;
            padding-top: 50%;
            font-size: 40px;
        }
    </style>
</head>
<body>
<%@ include file="../header_1.jsp" %>
<div class="container">
    <div class="row">
        <div class="col-md-1">
        	<%@ include file ="../menu.jsp" %>
        </div>
        <div class="col-md-11">
            <div class="mask">
                <span style="margin:auto;">
                    <i class="fa fa-spinner fa-spin"></i>
                </span>
            </div>
            <!-- page-content -->
            <div class="page-content">
                <div class="page-comm">
                    <div class="deliverComment">
                        <div class="commentTop">
                            <div class="leftImg">
                                <img src="${goods.picurl }">
                            </div>
                            <div class="title">${goods.name }</div>
                        </div>
                        <textarea style="border: 1px gray solid; " name="comment" id="comment"  placeholder="请输入你要填写的内容"></textarea>
                        <div class="commentBottom">
                            <div class="stars">
                          		      评分:
                                <span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span><span class="fa fa-star"></span>
                            </div>
                            <button id="saveComment" class="btn btn-default deliverBtn">发表</button>
                        </div>
                    </div>
                </div>
                <input type="hidden" value="score">
                <input type="hidden" id="goodsid" value="${goods.id}">
                <input type="hidden" id="orderItemId" value="${orderItemid}">
                <input type="hidden" id="orderid" value="${orderid }">
            </div>
            <!-- /.page-content -->


            <form id="validation-form" method="get" action="http://192.168.1.42:8888/shop-pc/manage/order/create">

            </form>
        </div>
    </div>
</div>

<%@ include file="../footer.jsp" %>
</body>

<script>
var score="";
    $(function(){
        /**
         *  @desc 点击打分
         */
        $(".stars span").on("click", function () {
            var stars = $(this).parents(".stars").find("span").removeClass("active");
            var index = stars.index(this);
             score = index + 1;
//            stars.removeClass("fa-star").addClass("fa-star-o");
            for( var i = 0; i <= index; i++){
                stars.eq(i).addClass("active");
            }
        });
    })
    
    $("#saveComment").on("click",function(){
    	var comment = $("#comment").val();
    	var dscore = score*2;
    	var goodsid=$("#goodsid").val(); 
    	var orderid=$("#orderid").val();
    	var orderItemId=$("#orderItemId").val();
    	window.location.href="${path}/manage/myCenter/savecomment?score="+dscore+"&comment="+
    			comment+"&goodsid="+goodsid+"&orderid="+orderid+"&orderItemId="+orderItemId;
    			
    });
</script>
</html>